package fjh.Interface;
/*
（3）设计一个类UseCompute，含有方法：public void useCom(Compute com, int one, int two)

        此方法要求能够：
        1．用传递过来的对象调用computer方法完成运算

        2．输出运算的结果

        （4）设计一个测试类，调用UseCompute中的方法useCom来完成+-/*运算
 */
public class UseCompute {

    Compute com;
    public void useCom(Compute com,int one,int two)
    {
        if(com instanceof Plus) {
            System.out.println(one + "+" + two + "=" + com.computer(one, two));
        }else if(com instanceof Sub)
        {
            System.out.println(one + "-" + two + "=" + com.computer(one, two));
        }else if(com instanceof Mul)
        {
            System.out.println(one + "*" + two + "=" + com.computer(one, two));
        }else if(com instanceof Div)
        {
            System.out.println(one + "/" + two + "=" + com.computer(one, two));
        }
    }
}
